using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace imitateMacQQ.WebApi.Repository.EFCore.Model.Circle;

[Table("friendCircle")]
public class FriendCircle
{
    public int Id { get; set; }
    public DateTime SendTime { get; set; }
    [Required] [MaxLength(50)] public string? SendAccount { get; set; }
    public string? Content { get; set; }
    public int LikeSum { get; set; }
    public bool HasPrintPicture { get; set; }
    [MaxLength(1000)] public string? PrintPicture { get; set; }
    [MaxLength(254)] public string? Remarks { get; set; } //后端外键 绑定评论表主健
    public bool IsShow { get; set; }
    public bool IsDelete { get; set; }

    // public FriendCircle(string remarks)
    // {
    //     Remarks = remarks;
    //     // var res = CreateRemarks().Result;
    //     // if (!res)
    //     //     throw new Exception("Remarks Is Not Only!");
    // }

    // private async Task<bool> CreateRemarks()
    // {
    //     await using DataDbContext db = new DataDbContext();
    //     var res = await db.Remarks.FirstOrDefaultAsync(e =>
    //         e.Remarks == Remarks);
    //     if (res is not null)
    //         return false;
    //     db.Remarks.Add(new Remark()
    //     {
    //         Remarks = Remarks
    //     });
    //     await db.SaveChangesAsync();
    //     return true;
    // }
}